﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Nim.IO
{
    class FileSystem
    {
        private static TextWriter tr;

        //Read a file and return its contents
        public static string ReadFile(string path)
        {
            string file = "";

            TextReader reader = new StreamReader(path);

            file = reader.ReadToEnd();

            reader.Close();

            return file;
        }

        //Open a file (will not append)
        public static void OpenFile(string path)
        {
            tr = new StreamWriter(path,false);
        }

        //Write a line to the file
        public static void FileWriteLine(string line)
        {
            tr.WriteLine(line);
        }

        //Close the file
        public static void CloseFile()
        {
            tr.Flush();
            tr.Close();
        }
    }
}
